<?php
include '../Module/CountryModule.php';
$contr=new CountryModule();
if(isset($_REQUEST["action"])){
    switch ($_REQUEST["action"]){
        case "add":
            $name		=isset($_REQUEST["name"])?EndcodeStr($_REQUEST["name"]):"";
            $brief		=isset($_REQUEST["brief"])?EndcodeStr($_REQUEST["brief"]):"";
            $flag       =isset($_REQUEST["flag"])?EndcodeStr($_REQUEST["flag"]):"";
            $map		=isset($_REQUEST["map"])?EndcodeStr($_REQUEST["map"]):"";
            $background		=isset($_REQUEST["background"])?EndcodeStr($_REQUEST["background"]):"";
            $geography		=isset($_REQUEST["geography"])?EndcodeStr($_REQUEST["geography"]):"";
            $demographics		=isset($_REQUEST["demographics"])?EndcodeStr($_REQUEST["demographics"]):"";
            $government		=isset($_REQUEST["government"])?EndcodeStr($_REQUEST["government"]):"";
            $economy		=isset($_REQUEST["economy"])?EndcodeStr($_REQUEST["economy"]):"";
            $communications		=isset($_REQUEST["communications"])?EndcodeStr($_REQUEST["communications"]):"";
            $transportation		=isset($_REQUEST["transportation"])?EndcodeStr($_REQUEST["transportation"]):"";
            $des		=isset($_REQUEST["des"])?EndcodeStr($_REQUEST["des"]):"";
            if($contr->insertCountry($name,$brief,$flag,$map, $background, $geography,$demographics, $government, $economy, $communications,$transportation,$des)){
                echo "true";
            }else{
                echo "Error<br/>".$contr->error;
            }
            break;
        case "edit":
            $id		=isset($_REQUEST["id"])?EndcodeStr($_REQUEST["id"]):"";
            $name		=isset($_REQUEST["name"])?EndcodeStr($_REQUEST["name"]):"";
            $brief		=isset($_REQUEST["brief"])?EndcodeStr($_REQUEST["brief"]):"";
            $flag       =isset($_REQUEST["flag"])?EndcodeStr($_REQUEST["flag"]):"";
            $map		=isset($_REQUEST["map"])?EndcodeStr($_REQUEST["map"]):"";
            $background		=isset($_REQUEST["background"])?EndcodeStr($_REQUEST["background"]):"";
            $geography		=isset($_REQUEST["geography"])?EndcodeStr($_REQUEST["geography"]):"";
            $demographics		=isset($_REQUEST["demographics"])?EndcodeStr($_REQUEST["demographics"]):"";
            $government		=isset($_REQUEST["government"])?EndcodeStr($_REQUEST["government"]):"";
            $economy		=isset($_REQUEST["economy"])?EndcodeStr($_REQUEST["economy"]):"";
            $communications		=isset($_REQUEST["communications"])?EndcodeStr($_REQUEST["communications"]):"";
            $transportation		=isset($_REQUEST["transportation"])?EndcodeStr($_REQUEST["transportation"]):"";
            $des		=isset($_REQUEST["des"])?EndcodeStr($_REQUEST["des"]):"";
            if($contr->updateCountry($id,$name,$brief,$flag,$map, $background, $geography,$demographics, $government, $economy, $communications,$transportation,$des)){
                echo "true";
            }else{
                echo "Error<br/>".$contr->error;
            }
            break;
    }    
}

?>
